package model;


public class Board {

	private char[][] board;

	public Board(int height, int width) {
		board = new char[height][width];
	}

	public char get(int row, int col) {
		return board[row][col];
	}

	public void set(int row, int col, char value) {
		board[row][col] = value;
	}

	public int getWidth() {
		return board[0].length;
	}

	public int getHeight() {
		return board.length;
	}

	public boolean isFull() {
		boolean full = false;
		int row = 0;
		while (row < board.length && !full) {
			full = (isRowFull(row));
			row++;
		}
		return full;
	}

	public boolean isRowFull(int row) {
		boolean full = true;
		int col = 0;
		while (col < board[0].length && full) {
			full = board[row][col] == '0';
			col++;
		}
		return full;
	}
	
	//other useful methods

	public char[][] toArray() {
		return board;
	}

	public String toString(){
		String result = getWidth() + " " + getHeight();
		for(int i = 0; i < getWidth(); i++){
			for(int j = 0; j < getHeight(); j++){
				result += " " + board[i][j];
			}
		}
		return result;
	}
}
